import cv2
import numpy as np
import matplotlib.pyplot as plt


cv2.namedWindow("mouse", cv2.WINDOW_NORMAL)
cv2.resizeWindow("mouse", 700, 500)

def mouse_callback(event, x, y, flags, userdata):
    print(event, x, y, flags, userdata)

cv2.setMouseCallback("mouse", mouse_callback,"")

#黑色图像
image = np.zeros((500, 700, 3), np.uint8)

while True:
    cv2.imshow("mouse", image)
    key = cv2.waitKey(1) & 0xFF
    if key == ord('q'):
        break

cv2.destroyAllWindows()



